package com.car.dal.dao.sudent;

import java.util.List;

import com.car.bean.GridObj;
import com.car.bean.OrderObj;
import com.car.bean.PageObj;
import com.car.dal.dao.ibatis.IbatisCommonDao;
import com.car.dal.object.TgStudent;
import com.car.util.Page;

public class StudentDaoImpl extends IbatisCommonDao<TgStudent, Long> implements StudentDao {

	public GridObj GetList(TgStudent student, PageObj pageObj) {
		OrderObj order = new OrderObj();
		order.setDir("desc");
		order.setSort("id");
		return super.findByPage(student, pageObj, order);
	}
	
	public List<TgStudent> getAgeFeature(TgStudent student) {
		List<TgStudent> list=this.queryForEntityList(TgStudent.class,"getAgeFeature", student);
		return list;
	}
	
	public List<TgStudent> getApply(TgStudent student) {
		List<TgStudent> list=this.queryForEntityList(TgStudent.class,"getApply", student);
		return list;
	}
	
	public List<TgStudent> getStudentByType(TgStudent student) {
		List<TgStudent> list=this.queryForEntityList(TgStudent.class,"getStudentByType", student);
		return list;
	}
	
	public Integer getAllStudentCouByType(TgStudent student) {
		List<TgStudent> list=this.queryForEntityList(TgStudent.class,"getAllStudentCouByType", student);
		if(list!=null){
			return list.size();
		}
		return 0;
	}
	
	public List<TgStudent> getAllStudentListByType(TgStudent student,Page page) {
		student.setFirstrownum(page.getFirstrownum());
		student.setPagesize(page.getPagesize());
		List<TgStudent> list=this.queryForEntityList(TgStudent.class,"getAllStudentListByType", student);
		return list;
	}
	
	public List<TgStudent> getAllStudentListByType2(TgStudent student) {
		List<TgStudent> list=this.queryForEntityList(TgStudent.class,"getAllStudentListByType2", student);
		return list;
	}
	
	public List<TgStudent> getAllStudentListByType3(TgStudent student) {
		List<TgStudent> list=this.queryForEntityList(TgStudent.class,"getAllStudentListByType3", student);
		return list;
	}
	
	public TgStudent getStudentById(Long id) {
		TgStudent student = new TgStudent();
		student.setId(id);
		List<TgStudent> list=this.queryForEntityList(TgStudent.class,"getStudentById", student);
		if(list!=null && list.size()>0){
			return list.get(0);
		}
		return null;
	}
}
